//
//  FileManager.m
//  village_ios
//
//  Created by mac on 2019/8/4.
//  Copyright © 2019 com.sw.village. All rights reserved.
//

#import "FileManager.h"

@implementation FileManager
// 读取本地JSON文件
+ (NSDictionary *)readLocalFileWithName:(NSString *)name {
    // 获取文件路径
    NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"json"];
    // 将文件数据化
    NSData *data = [[NSData alloc] initWithContentsOfFile:path];
    // 对数据进行JSON格式化并返回字典形式
    return [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.demoDictM = [NSDictionary dictionary];
        self.demoDictM = [FileManager readLocalFileWithName:@"demo"];
        
        
    }
    return self;
}
+ (instancetype)sharedInstance
{
    static FileManager *sharedManager;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedManager = [[FileManager alloc] init];
    });
    
    return sharedManager;
}
@end
